<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<div>
    <table id="wQbdFalProblemresetTable" lay-filter="wQbdFalProblemresetTable"></table>
    <form class="reportList-isShow">
        <input type="hidden" id="successDataId" name="successDataId">
    </form>
</div>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdFalProblemresetRightToolsBar">
    <@f.a alias="xqan_zlwt1,xqan_zlwt2,xqan_zlwt3" event="particulars" css="RightBtn">详情</@f.a>

    <@f.a alias="xqan_zlwt3y" event="particularsSanYuan" css="RightBtn">详情</@f.a>
</script>

<script>
    //一般直接写在一个js文件中
    layui.use(['table', 'common','publicMethods','jquery','layer'], function () {
        var table = layui.table;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;

        var tableH=publicMethods.layerHeight();
        var dataId = "${dataId}";

        //第一个实例
        table.render({
            elem: '#wQbdFalProblemresetTable'
            ,height:tableH
            ,url: serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/reportList?id='+dataId+"&tableName=w_qbd_fal_problemreset"
            ,method: 'post'
            ,autoSort: false //是否排序
            ,cols: [[ //表头
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
                ,{field: 'filldept', title: '数据来源单位',hide:false,minWidth:120}
                ,{field: 'fProblemname', title: '质量问题名称',hide:false,minWidth:120}
                ,{field: 'fModelsymbol', title: '型号代号',hide:false,minWidth:110}
                ,{field: 'fProductname', title: '故障产品名称',hide:false,minWidth:120}
                ,{field: 'fDetecttime', title: '问题发生时间',hide:false,minWidth:120,templet: function (d) {
                        return publicMethods.timeData(d.fDetecttime);
                    }}
                ,{field: 'fModeldevelopphase', title: '型号研制阶段',hide:false,minWidth:120}
                ,{field: 'fIfreset', title: '是否完成归零',hide:false,minWidth:120}
                ,{field: 'fProblemlever', title: '问题级别',hide:false,minWidth:110}
                // ,{field: 'id', title: '主键',sort:true, sortname: 'id'}
                // ,{field: 'fFillman', title: '填写人',sort:true, sortname: 'f_fillman'}
                // ,{field: 'fFillmanaccount', title: '填写人的账号',sort:true, sortname: 'f_fillmanaccount'}
                // ,{field: 'fStatus', title: '状态',sort:true, sortname: 'f_status'}
                // ,{field: 'fSuperviseid', title: 'fSuperviseid',sort:true, sortname: 'f_superviseid'}
                // ,{field: 'fManagefactoranalysis', title: 'fManagefactoranalysis',sort:true, sortname: 'f_managefactoranalysis'}
                // //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.fSkillresettime,"1");
                // //如需转换为HH:mm:ss: return publicMethods.timeData(d.fSkillresettime,"2");
                // // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.fSkillresettime);
                // ,{field: 'fSkillresettime', title: '技术归零时间',sort:true, sortname: 'f_skillresettime',templet: function (d) {
                //     return publicMethods.timeData(d.fSkillresettime);
                // }}
                //
                // ,{field: 'reportStatus', title: ' 上报状态。',sort:true, sortname: 'report_status'}
                // ,{field: 'fReportReason', title: 'fReportReason',sort:true, sortname: 'f_report_reason'}
                ,{
                    fixed: 'right',
                    title: '管理',
                    width:90,
                    align: 'center',
                    toolbar: '#wQbdFalProblemresetRightToolsBar'
                }
            ]]
        });

        table.on('tool(wQbdFalProblemresetTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                    layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "particulars":
                    var height=publicMethods.layHeight('body');
                    layer.open({
                        type: 2,
                        area: ['96%', height],
                        title: ['质量问题信息明细'],
                        content: serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/particulars?id='+data.id + "&isClose=true"
                    });
                    break;
                case "particularsSanYuan":
                    var height=publicMethods.layHeight('body');
                    layer.open({
                        type: 2,
                        area: ['96%', height],
                        title: ['质量问题信息明细'],
                        content: serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/particularsSanYuan?id='+data.id
                    });
                    break;
            }
        });

        table.on('checkbox(wQbdFalProblemresetTable)', function(obj){
            if(obj.type == "all"){
                if(obj.checked){
                    $("input[name='successDataId']").val("");
                    var checkStatus = table.checkStatus('wQbdFalProblemresetTable');
                    var valArr = checkStatus.data;//选中行数据
                    var ceshiVal = $("input[name='successDataId']").val();
                    for(var i=0;i<valArr.length;i++){
                        ceshiVal =ceshiVal + valArr[i].id + ",";
                    }
                    $("input[name='successDataId']").val(ceshiVal);
                }else{
                    $("input[name='successDataId']").val("");
                }
            }else{
                if(obj.checked){
                    var ceshiVal = $("input[name='successDataId']").val();
                    $("input[name='successDataId']").val(ceshiVal + obj.data.id + ",");
                }else{
                    var ceshiVal = $("input[name='successDataId']").val();
                    var newVal = "";
                    var valArr = ceshiVal.split(obj.data.id+",");
                    for(var i=0;i<valArr.length;i++){
                        newVal += valArr[i];
                    }
                    $("input[name='successDataId']").val(newVal);
                }
            }
        });

    });
</script>
<!--</body>-->
<!--</html>-->